<!-- templates/edit_profile.html -->
{% extends "base.html" %}

{% block title %}编辑资料 - 校园摄影投票系统{% endblock %}

{% block content %}
    <div class="row justify-content-center">
        <div class="col-md-6">
            <div class="card">
                <div class="card-header">
                    <h4>编辑个人资料</h4>
                </div>
                <div class="card-body">
                    <form method="POST" enctype="multipart/form-data">
                        {{ form.hidden_tag() }}

                        <div class="mb-3">
                            {{ form.username.label(class="form-label") }}
                            {{ form.username(class="form-control") }}
                            {% for error in form.username.errors %}
                                <div class="invalid-feedback d-block">{{ error }}</div>
                            {% endfor %}
                        </div>

                        <div class="mb-3">
                            {{ form.bio.label(class="form-label") }}
                            {{ form.bio(class="form-control", rows=3) }}
                            {% for error in form.bio.errors %}
                                <div class="invalid-feedback d-block">{{ error }}</div>
                            {% endfor %}
                        </div>

                        <div class="mb-3">
                            {{ form.gender.label(class="form-label") }}
                            {{ form.gender(class="form-select") }}
                            {% for error in form.gender.errors %}
                                <div class="invalid-feedback d-block">{{ error }}</div>
                            {% endfor %}
                        </div>

                        <div class="mb-3">
                            {{ form.avatar.label(class="form-label") }}
                            {{ form.avatar(class="form-control") }}
                            <div class="form-text">支持格式: JPG, PNG (最大3MB)</div>
                            {% for error in form.avatar.errors %}
                                <div class="invalid-feedback d-block">{{ error }}</div>
                            {% endfor %}
                        </div>

                        <button type="submit" class="btn btn-primary">保存更改</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
{% endblock %}